using System;
using System.Runtime.InteropServices;

namespace WindowsAPI.PE
{
    [StructLayout(LayoutKind.Explicit)]
    public struct Section_Header
    {
        [FieldOffset(0)]
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
        public char[] Name;

        [FieldOffset(8)]
        public ulong VirtualSize;

        [FieldOffset(12)]
        public ulong VirtualAddress;

        [FieldOffset(16)]
        public ulong SizeOfRawData;

        [FieldOffset(20)]
        public ulong PointerToRawData;

        [FieldOffset(24)]
        public ulong PointerToRelocations;

        [FieldOffset(28)]
        public ulong PointerToLinenumbers;

        [FieldOffset(32)]
        public UInt16 NumberOfRelocations;

        [FieldOffset(34)]
        public UInt16 NumberOfLinenumbers;

        [FieldOffset(36)]
        public DataSectionFlags Characteristics;

        public string Section { get { return new string(Name); } }
    }
}